package com.lbc.function;

import java.util.function.Predicate;

/**
 *   Predicate  断定型接口
 */
public class Demo02 {
    public static void main(String[] args) {
        //  输入一个参数，返回一个 Boolean 值
        //  判断字符串是否为空
        Predicate<String> predicate = new Predicate<String>(){
            @Override
            public boolean test(String str) {
                return str.isEmpty();
            }
        };
        System.out.println(predicate.test(""));

        Predicate<String> predicate2 = (str) -> { return str.isEmpty(); };
        System.out.println(predicate2.test("haha2"));
    }
}
